//走马灯
<template>
	<div>
		<el-carousel :interval="4000" type="card" height="200px"  ref="carousel" @click.native="linkTo">
		<!---注意：@click后加.native--->
        	<el-carousel-item v-for="item in imgs" :key="item.url">
          		<img :src="item.url"/>
        	</el-carousel-item>
     	 </el-carousel>
	</div>
</template>

<script>
export default {
  data() {
    return {
          imgs: [
          		 {url: require('../../assets/img/checkexam.png'), link: 'selectExam'},//考试查询
               {url: require('../../assets/img/selectExamToPart.png'), link: 'paperCategory'},//试卷列表
              //  {url: require('../../assets/img/allStudentsGrade.png'), link: 'allStudentsGrade'},//学生成绩查询
               {url: require('../../assets/img/answerDescription.png'), link: 'answerDescription'},//题库管理
               {url: require('../../assets/img/studentManage.png'), link: 'studentsManage'},//学生管理
              //{url: require('图片地址'), link: '路由地址'},
      		]
    	};
  },
  methods: {
    linkTo () {  //跳转路由
      let activeIndex = this.$refs.carousel.activeIndex
      this.$router.push(this.imgs[activeIndex].link)
    }
  },
}
</script>

<style>
  .el-carousel__item h3 {
    color: #475669;
    font-size: 14px;
    opacity: 0.75;
    line-height: 200px;
    margin: 0;
  }
  
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }
  
  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
</style>